package com.uzai.console.web.wechatwork;

import com.alibaba.fastjson.JSONObject;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.common.enums.DeviceTypeEnum;
import com.uzai.common.enums.WxworkProductKeyEnum;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.common.utils.Tools;
import com.uzai.console.dto.devicegroup.DeviceGroupIdDto;
import com.uzai.console.dto.devicegroup.DeviceGroupInfoDto;
import com.uzai.console.dto.devicegroup.DeviceGroupQuery;
import com.uzai.console.dto.wechatprivate.configplan.ConfigPlanQuery;
import com.uzai.console.dto.wechatwork.devicewxworkinfo.*;
import com.uzai.console.entity.ConfigPlan;
import com.uzai.console.entity.DeviceGroup;
import com.uzai.console.entity.DeviceProduct;
import com.uzai.console.entity.DeviceWxworkInfo;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.enums.WxworkDeviceProductEnum;
import com.uzai.console.mapper.*;
import com.uzai.console.service.devicegroup.DeviceGroupService;
import com.uzai.console.service.wechatwork.DeviceWxworkInfoService;
import com.uzai.console.vo.base.SelectKeyVo;
import com.uzai.console.vo.devicegroup.DeviceGroupInfoVo;
import com.uzai.console.vo.deviceproduct.DeviceProductVo;
import com.uzai.console.vo.wechatprivate.devicewechatinfo.DeviceAmountVo;
import com.uzai.console.vo.wechatprivate.devicewechatinfo.DeviceWechatInfoAddVo;
import com.uzai.console.vo.wechatwork.devicewxworkinfo.DeviceWxworkInfoAddVo;
import com.uzai.console.vo.wechatwork.devicewxworkinfo.DeviceWxworkInfoVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * 企业微信机器人管理
 *
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "企业微信机器人管理", tags = "企业微信|机器人管理")
@ApiSort(6)
@RestController
public class DeviceWxworkInfoController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(DeviceWxworkInfoController.class);

    @Autowired
    private DeviceWxworkInfoService deviceWxworkInfoService;
    @Autowired
    private SysRoleMapper sysRoleMapper;
    @Autowired
    private DeviceGroupService deviceGroupService;
    @Autowired
    private DeviceGroupMapper deviceGroupMapper;
    @Autowired
    private UserTypeGroupMapper userTypeGroupMapper;
    @Autowired
    private ConfigPlanMapper configPlanMapper;
    @Autowired
    private DeviceWxworkInfoMapper deviceWxworkInfoMapper;
    @Autowired
    private DeviceProductMapper deviceProductMapper;

    @ApiOperation(value = "分页查询企业微信机器人列表", notes = "分页查询企业微信机器人列表", response = DeviceWxworkInfoVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/deviceWxworkInfo/findDeviceWxworkInfoList")
    public Object findDeviceWxworkInfoList(@RequestBody DeviceWxworkInfoQuery deviceWxworkInfoQuery) {
        return deviceWxworkInfoService.findDeviceWxworkInfoList(deviceWxworkInfoQuery);
    }

    @ApiOperation(value = "查询企业微信机器人信息", notes = "查询企业微信机器人信息", response = DeviceWxworkInfoVo.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/deviceWxworkInfo/findDeviceWxworkInfo")
    public Object findDeviceWxworkInfoInfo(@RequestBody DeviceWxworkInfoIdDto deviceWxworkInfoIdDto) {
        return deviceWxworkInfoService.findDeviceWxworkInfoInfo(deviceWxworkInfoIdDto);
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "编辑企业微信机器人信息", notes = "编辑企业微信机器人信息")
    @ApiOperationSupport(order = 3)
    @PostMapping("/deviceWxworkInfo/updateDeviceWxworkInfo")
    public Object updateDeviceWxworkInfo(@RequestBody DeviceWxworkInfoDto deviceWxworkInfoDto) {
        deviceWxworkInfoService.updateDeviceWxworkInfo(deviceWxworkInfoDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "批量修改企业微信机器人", notes = "批量修改企业微信机器人")
    @ApiOperationSupport(order = 3)
    @PostMapping("/deviceWxworkInfo/batchUpdateDeviceWxworkInfo")
    public Object batchUpdateDeviceWxworkInfo(@RequestBody DeviceWxworkInfoBatchDto deviceWxworkInfoBatchDto) {
        deviceWxworkInfoService.batchUpdateDeviceWxworkInfo(deviceWxworkInfoBatchDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "删除企业微信机器人(转移会员订单数据)", notes = "删除企业微信机器人(转移会员订单数据)")
    @ApiOperationSupport(order = 4)
    @PostMapping("/deviceWxworkInfo/delDeviceWxworkInfo")
    public Object delDeviceWxworkInfo(@RequestBody DeviceWxworkInfoDelDto deviceWxworkInfoDelDto) {
        return deviceWxworkInfoService.delDeviceWxworkInfo(deviceWxworkInfoDelDto);
    }

    @ApiOperation(value = "查询同类型组的企业微信机器人下拉列表框列表（过滤自己和不是同类型组的机器人）", notes = "查询同类型组的企业微信机器人下拉列表框列表（过滤自己和不是同类型组的机器人）", response = DeviceWxworkInfoVo.class)
    @ApiOperationSupport(order = 4)
    @PostMapping("/deviceWxworkInfo/findSameGroupDeviceList")
    public Object findSameGroupDeviceList(@RequestBody DeviceWxworkInfoIdDto deviceWxworkInfoIdDto) {
        List<DeviceWxworkInfoVo> deviceWxworkInfoVoList = new ArrayList<>();
        if (deviceWxworkInfoIdDto.getId() != null) {
            DeviceWxworkInfo deviceWxworkInfo_self = deviceWxworkInfoMapper.selectById(deviceWxworkInfoIdDto.getId(), deviceWxworkInfoIdDto.getMerId());
            if (deviceWxworkInfo_self != null) {
                ConfigPlan configPlan_self = configPlanMapper.selectById(deviceWxworkInfo_self.getConfigId(), deviceWxworkInfoIdDto.getMerId());
                if (configPlan_self != null) {
                    Long userTypeGroupId_self = configPlan_self.getUserTypeGroupId();
                    if (userTypeGroupId_self != null) {
                        DeviceWxworkInfoQuery deviceWxworkInfoQuery = new DeviceWxworkInfoQuery();
                        deviceWxworkInfoQuery.setMerId(getLoginInfo().getMerId());
                        List<DeviceWxworkInfo> deviceWxworkInfoList = deviceWxworkInfoMapper.findByList(deviceWxworkInfoQuery);
                        if (deviceWxworkInfoList != null) {
                            for (DeviceWxworkInfo deviceWxworkInfo : deviceWxworkInfoList) {
                                //过滤自己
                                if (deviceWxworkInfoIdDto.getId().longValue() != deviceWxworkInfo.getId().longValue()) {
                                    ConfigPlan configPlan = configPlanMapper.selectById(deviceWxworkInfo.getConfigId(), deviceWxworkInfoIdDto.getMerId());
                                    //同一个会员类型组的机器人才能查询出来
                                    if (configPlan != null && Tools.getLong(configPlan.getUserTypeGroupId()).longValue() == userTypeGroupId_self.longValue()) {
                                        DeviceWxworkInfoVo deviceWxworkInfoVo = new DeviceWxworkInfoVo();
                                        BeanUtils.copyProperties(deviceWxworkInfo, deviceWxworkInfoVo);
                                        deviceWxworkInfoVoList.add(deviceWxworkInfoVo);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return deviceWxworkInfoVoList;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "批量删除企业微信机器人", notes = "批量删除企业微信机器人")
    @ApiOperationSupport(order = 4)
    @PostMapping("/deviceWxworkInfo/batchDelDeviceWxworkInfo")
    public Object batchDelDeviceWxworkInfo(@RequestBody DeviceWxworkInfoIdListDto deviceWxworkInfoIdListDto) {
        deviceWxworkInfoService.batchDelDeviceWxworkInfo(deviceWxworkInfoIdListDto);
        return true;
    }

    @ApiOperation(value = "分页查询企业微信机器人分组列表", notes = "分页查询企业微信机器人分组列表", response = DeviceGroupInfoVo.class)
    @ApiOperationSupport(order = 5)
    @PostMapping("/deviceWxworkInfo/findDeviceGroupList")
    public Object findDeviceGroupList(@RequestBody DeviceGroupQuery deviceGroupQuery) {
        deviceGroupQuery.setDeviceType(DeviceTypeEnum.DT_WORK_WECHAT.getKey());
        return deviceGroupService.findDeviceGroupList(deviceGroupQuery);
    }

    @ApiOperation(value = "查询企业微信机器人分组详情", notes = "查询企业微信机器人分组详情", response = DeviceGroupInfoVo.class)
    @ApiOperationSupport(order = 6)
    @PostMapping("/deviceWxworkInfo/findDeviceGroupInfo")
    public Object findDeviceGroupInfo(@RequestBody DeviceGroupIdDto deviceGroupIdDto) {
        return deviceGroupService.findDeviceGroupInfo(deviceGroupIdDto);
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.ADD)
    @ApiOperation(value = "添加企业微信机器人分组", notes = "添加企业微信机器人分组")
    @ApiOperationSupport(order = 7)
    @PostMapping("/deviceWxworkInfo/addDeviceGroup")
    public Object addDeviceGroup(@RequestBody DeviceGroupInfoDto deviceGroupInfoDto) {
        //添加企业微信机器人分组
        deviceGroupInfoDto.setDeviceType(DeviceTypeEnum.DT_WORK_WECHAT.getKey());
        deviceGroupService.addDeviceGroup(deviceGroupInfoDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "编辑企业微信机器人分组", notes = "编辑企业微信机器人分组")
    @ApiOperationSupport(order = 8)
    @PostMapping("/deviceWxworkInfo/updateDeviceGroup")
    public Object updateDeviceGroup(@RequestBody DeviceGroupInfoDto deviceGroupInfoDto) {
        deviceGroupInfoDto.setDeviceType(DeviceTypeEnum.DT_WORK_WECHAT.getKey());
        deviceGroupService.updateDeviceGroup(deviceGroupInfoDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "删除企业微信机器人分组", notes = "删除企业微信机器人分组")
    @ApiOperationSupport(order = 9)
    @PostMapping("/deviceWxworkInfo/deleteDeviceGroup")
    public Object deleteDeviceGroup(@RequestBody DeviceGroupIdDto deviceGroupIdDto) {
        deviceGroupService.deleteDeviceGroup(deviceGroupIdDto);
        return true;
    }

    @ApiOperation(value = "查询企业微信机器人分组下拉选择框列表", notes = "查询企业微信机器人分组下拉选择框列表")
    @ApiOperationSupport(order = 10)
    @PostMapping("/deviceWxworkInfo/findDeviceGroupSelect")
    public Object findDeviceGroupSelect() {
        List<SelectKeyVo> selectIdVoList = new ArrayList<>();
        DeviceGroupQuery deviceGroupQuery = new DeviceGroupQuery();
        deviceGroupQuery.setMerId(getLoginInfo().getMerId());
        deviceGroupQuery.setDeviceType(DeviceTypeEnum.DT_WORK_WECHAT.getKey());
        List<DeviceGroup> deviceGroupList = deviceGroupMapper.findByList(deviceGroupQuery);
        if (deviceGroupList != null) {
            for (DeviceGroup deviceGroup : deviceGroupList) {
                SelectKeyVo selectKeyVo = new SelectKeyVo();
                selectKeyVo.setKey(String.valueOf(deviceGroup.getId()));
                selectKeyVo.setValue(deviceGroup.getName());
                selectIdVoList.add(selectKeyVo);
            }
        }
        return selectIdVoList;
    }

    @ApiOperation(value = "查询配置方案下拉选择框列表", notes = "查询配置方案下拉选择框列表")
    @ApiOperationSupport(order = 12)
    @PostMapping("/deviceWxworkInfo/findConfigPlanSelect")
    public Object findConfigPlanSelect() {
        List<SelectKeyVo> selectIdVoList = new ArrayList<>();
        ConfigPlanQuery configPlanQuery = new ConfigPlanQuery();
        configPlanQuery.setMerId(getLoginInfo().getMerId());
        configPlanQuery.setDeviceType(DeviceTypeEnum.DT_WORK_WECHAT.getKey());
        List<ConfigPlan> configPlanList = configPlanMapper.findByList(configPlanQuery);
        if (configPlanList != null) {
            for (ConfigPlan configPlan : configPlanList) {
                SelectKeyVo selectKeyVo = new SelectKeyVo();
                selectKeyVo.setKey(String.valueOf(configPlan.getId()));
                selectKeyVo.setValue(configPlan.getName());
                selectIdVoList.add(selectKeyVo);
            }
        }
        return selectIdVoList;
    }

    @ApiOperation(value = "查询设备功能类型列表", notes = "查询设备功能类型列表", response = DeviceProductVo.class)
    @ApiOperationSupport(order = 13)
    @PostMapping("/deviceWxworkInfo/deviceProductList")
    public Object deviceProductList() {
        List<DeviceProductVo> deviceProductVoList = new ArrayList<>();
        WxworkDeviceProductEnum[] wxworkDeviceProductEnums = WxworkDeviceProductEnum.values();
        if (wxworkDeviceProductEnums != null && wxworkDeviceProductEnums.length > 0) {
            for (WxworkDeviceProductEnum wxworkDeviceProductEnum : wxworkDeviceProductEnums) {
                DeviceProductVo deviceProductVo = new DeviceProductVo();
                DeviceProduct deviceProduct = deviceProductMapper.selectByCode(wxworkDeviceProductEnum.getValue());
                if (deviceProduct != null) {
                    BeanUtils.copyProperties(deviceProduct, deviceProductVo);
                }

                deviceProductVo.setName(wxworkDeviceProductEnum.getDesc());

                if (StringUtils.isNotBlank(wxworkDeviceProductEnum.getCodes())) {
                    deviceProductVo.setCodeList(JSONObject.parseArray(wxworkDeviceProductEnum.getCodes(), String.class));
                }
                deviceProductVoList.add(deviceProductVo);
            }
        }
        return deviceProductVoList;
    }

    @ApiOperation(value = "查询企业微信机器人产品列表", notes = "查询企业微信机器人产品列表")
    @ApiOperationSupport(order = 13)
    @PostMapping("/deviceWxworkInfo/findDeviceProductList")
    public Object findDeviceProductList() {
        List<SelectKeyVo> selectIdVoList = new ArrayList<>();
        WxworkProductKeyEnum[] wxworkProductKeyEnums = WxworkProductKeyEnum.values();
        if (wxworkProductKeyEnums != null) {
            for (WxworkProductKeyEnum wxworkProductKeyEnum : wxworkProductKeyEnums) {
                SelectKeyVo selectKeyVo = new SelectKeyVo();
                selectKeyVo.setKey(wxworkProductKeyEnum.getValue());
                selectKeyVo.setValue(wxworkProductKeyEnum.getDesc());
                selectIdVoList.add(selectKeyVo);
            }
        }
        return selectIdVoList;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "更新PC端软件", notes = "更新PC端软件")
    @ApiOperationSupport(order = 13)
    @PostMapping("/deviceWxworkInfo/updatePcClientSoft")
    public Object updatePcClientSoft(@RequestBody DeviceWxworkInfoIdDto deviceWxworkInfoIdDto) {
        deviceWxworkInfoService.updatePcClientSoft(deviceWxworkInfoIdDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "批量更新PC端软件", notes = "批量更新PC端软件")
    @ApiOperationSupport(order = 13)
    @PostMapping("/deviceWxworkInfo/batchUpdatePcClientSoft")
    public Object batchUpdatePcClientSoft(@RequestBody DeviceWxworkInfoIdListDto deviceWxworkInfoIdListDto) {
        deviceWxworkInfoService.batchUpdatePcClientSoft(deviceWxworkInfoIdListDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.RESTART)
    @ApiOperation(value = "重启PC端软件", notes = "重启PC端软件")
    @ApiOperationSupport(order = 14)
    @PostMapping("/deviceWxworkInfo/restartPcClientSoft")
    public Object restartPcClientSoft(@RequestBody DeviceWxworkInfoIdDto deviceWxworkInfoIdDto) {
        deviceWxworkInfoService.restartPcClientSoft(deviceWxworkInfoIdDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.RESTART)
    @ApiOperation(value = "批量重启PC端软件", notes = "批量重启PC端软件")
    @ApiOperationSupport(order = 14)
    @PostMapping("/deviceWxworkInfo/batchRestartPcClientSoft")
    public Object batchRestartPcClientSoft(@RequestBody DeviceWxworkInfoIdListDto deviceWxworkInfoIdListDto) {
        deviceWxworkInfoService.batchRestartPcClientSoft(deviceWxworkInfoIdListDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.QUIT)
    @ApiOperation(value = "退出PC端软件", notes = "退出PC端软件")
    @ApiOperationSupport(order = 15)
    @PostMapping("/deviceWxworkInfo/quitPcClientSoft")
    public Object quitPcClientSoft(@RequestBody DeviceWxworkInfoIdDto deviceWxworkInfoIdDto) {
        deviceWxworkInfoService.quitPcClientSoft(deviceWxworkInfoIdDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.QUIT)
    @ApiOperation(value = "批量退出PC端软件", notes = "批量退出PC端软件")
    @ApiOperationSupport(order = 15)
    @PostMapping("/deviceWxworkInfo/batchQuitPcClientSoft")
    public Object batchQuitPcClientSoft(@RequestBody DeviceWxworkInfoIdListDto deviceWxworkInfoIdListDto) {
        deviceWxworkInfoService.batchQuitPcClientSoft(deviceWxworkInfoIdListDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.QUIT)
    @ApiOperation(value = "退出PC端微信", notes = "退出PC端微信")
    @ApiOperationSupport(order = 16)
    @PostMapping("/deviceWxworkInfo/quitPcWechat")
    public Object quitPcWechat(@RequestBody DeviceWxworkInfoIdDto deviceWxworkInfoIdDto) {
        deviceWxworkInfoService.quitPcWechat(deviceWxworkInfoIdDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.QUIT)
    @ApiOperation(value = "批量退出PC端微信", notes = "批量退出PC端微信")
    @ApiOperationSupport(order = 16)
    @PostMapping("/deviceWxworkInfo/batchQuitPcWechat")
    public Object batchQuitPcWechat(@RequestBody DeviceWxworkInfoIdListDto deviceWxworkInfoIdListDto) {
        deviceWxworkInfoService.batchQuitPcWechat(deviceWxworkInfoIdListDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.BUY)
    @ApiOperation(value = "购买机器人授权", notes = "购买机器人授权", response = DeviceWxworkInfoAddVo.class)
    @ApiOperationSupport(order = 19)
    @PostMapping("/deviceWxworkInfo/buyDeviceAuth")
    public Object buyDeviceAuth(@RequestBody DeviceWxworkInfoBuyAuthDto deviceWxworkInfoBuyAuthDto) {
        return deviceWxworkInfoService.buyDeviceAuth(deviceWxworkInfoBuyAuthDto);
    }

    @ApiOperation(value = "查询添加机器人和购买授权总金额", notes = "查询添加机器人和购买授权总金额", response = DeviceAmountVo.class)
    @ApiOperationSupport(order = 20)
    @PostMapping("/deviceWxworkInfo/getAmount")
    public Object getAmount(@RequestBody DeviceWxworkAmountDto deviceWxworkAmountDto) {
        return deviceWxworkInfoService.getAmount(deviceWxworkAmountDto);
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "刷新在线状态", notes = "刷新在线状态")
    @ApiOperationSupport(order = 26)
    @PostMapping("/deviceWxworkInfo/refreshOnlineStatus")
    public Object refreshOnlineStatus() {
        deviceWxworkInfoService.refreshOnlineStatus(getLoginInfo().getMerId());
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.ADD)
    @ApiOperation(value = "增加试用期授权", notes = "增加试用期授权", response = Boolean.class)
    @ApiOperationSupport(order = 27)
    @PostMapping("/deviceWxworkInfo/addProbationAuth")
    public Object addProbationAuth(@RequestBody DeviceWxworkInfoAddProbationAuth deviceWxworkInfoAddProbationAuth) {
        deviceWxworkInfoService.addProbationAuth(deviceWxworkInfoAddProbationAuth);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "转移授权时间", notes = "转移授权时间")
    @ApiOperationSupport(order = 28)
    @PostMapping("/deviceWxworkInfo/transferAuthTime")
    public Object transferAuthTime(@RequestBody DeviceWxworkInfoTranferAuthTimeDto deviceWxworkInfoTranferAuthTimeDto) {
        deviceWxworkInfoService.transferAuthTime(deviceWxworkInfoTranferAuthTimeDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "修改机器人工作状态", notes = "修改机器人工作状态")
    @ApiOperationSupport(order = 29)
    @PostMapping("/deviceWxworkInfo/updateRecvmsgType")
    public Object updateRecvmsgType(@RequestBody DeviceWxworkRecvmsgTypeDto deviceWxworkRecvmsgTypeDto) {
        deviceWxworkInfoService.updateRecvmsgType(deviceWxworkRecvmsgTypeDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "批量修改机器人工作状态", notes = "批量修改机器人工作状态")
    @ApiOperationSupport(order = 29)
    @PostMapping("/deviceWxworkInfo/updateRecvmsgType/batch")
    public Object batchUpdateRecvmsgType(@RequestBody DeviceWxworkRecvmsgTypeBatchDto deviceWxworkRecvmsgTypeBatchDto) {
        deviceWxworkInfoService.batchUpdateRecvmsgType(deviceWxworkRecvmsgTypeBatchDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "更新手机版", notes = "更新手机版")
    @ApiOperationSupport(order = 30)
    @PostMapping("/deviceWxworkInfo/updateMobileClientSoft")
    public Object updateMobileClientSoft(@RequestBody DeviceWxworkInfoIdDto deviceWxworkInfoIdDto) {
        deviceWxworkInfoService.updateMobileClientSoft(deviceWxworkInfoIdDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "批量更新手机版", notes = "批量更新手机版")
    @ApiOperationSupport(order = 31)
    @PostMapping("/deviceWxworkInfo/batchUpdateMobileClientSoft")
    public Object batchUpdateMobileClientSoft(@RequestBody DeviceWxworkInfoIdListDto deviceWxworkInfoIdListDto) {
        deviceWxworkInfoService.batchUpdateMobileClientSoft(deviceWxworkInfoIdListDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkInfo, type = OperationTypeEnum.ADD)
    @ApiOperation(value = "添加机器人新版(只需要上传微信id)", notes = "添加机器人新版(只需要上传微信id)", response = DeviceWechatInfoAddVo.class)
    @ApiOperationSupport(order = 3)
    @PostMapping("/deviceWxworkInfo/addDeviceWechatInfo_new")
    public Object addDeviceWxworkInfo_new(@RequestBody DeviceWxworkInfoAddDto_new deviceWxworkInfoAddDto_new) {
        deviceWxworkInfoAddDto_new.setDeviceTypeId(9);
        deviceWxworkInfoService.addDeviceWxworkInfo_new(deviceWxworkInfoAddDto_new);
        return true;
    }

}
